#include "FbxExporter.h"

namespace GC
{
	using namespace GC;

	FbxExporter::FbxExporter(const _TCHAR* a_outputName)
	{
		m_outputName = a_outputName;
	}

	const bool FbxExporter::ExportToFile(const FbxData* a_data, const ExportFormat a_exportFormat) const
	{
		ConverterApp::LogMessage(L"Started Exporting data");

		bool f_finished = false;

		switch (a_exportFormat)
		{
			case ExportFormat::Json:				
				f_finished = ExportJson(a_data);
				break;
			default:
				ConverterApp::LogMessage(L"Not a valid export format");
				return false;
		}
		
		if (f_finished)
		{
			#if defined (_DEBUG)
				Cout << _T("Finished exporting") << std::endl;
			#endif
			ConverterApp::LogMessage(L"Finished exporting");
		}
		else
		{
			#if defined (_DEBUG)
				Cout << _T("Failed exporting") << std::endl;
			#endif
			ConverterApp::LogMessage(L"Failed exporting");
		}

		return f_finished;
	}

	const bool FbxExporter::ExportJson(const FbxData* a_data) const
	{	
		//Not const declared because it has few variables that changes
		FbxJsonExporter f_exporter = FbxJsonExporter(ConverterApp::GetSettings()->PrettifyOutput() );		
		return f_exporter.Export(a_data, m_outputName);		
	}
}